using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;

namespace System.Windows.Forms.ColorControls
{
    /// <summary>
    /// Summary description for TabbedColorPicker.
    /// </summary>
    public class TabbedColorPicker : ColorPickerBase
    {
        /// <summary>
        /// Initializes a new instance of the ColorPicker class.
        /// </summary>
        /// <remarks>
        /// The default constructor initializes all fields to their default values.
        /// </remarks>
        public TabbedColorPicker()
            : base()
        {
        }

        /// <summary>
        /// Display the ColorPicker's drop down palette.
        /// </summary>
        protected override PopupForm CreatePopup()
        {
            ColorPickerPopup p = new ColorPickerPopup();
            p.Popped += new EventHandler(OnPopupClosed);
            p.ColorChanged += new ColorChangedEventHandler(OnPopupColorChanged);
            return p;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="popup"></param>
        protected override void PrePopup(PopupForm popup)
        {
            ((ColorPickerPopup)popup).Color = this.Color;
        }

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            //
            // ColorPicker
            //
            this.BackColor = System.Drawing.SystemColors.Window;
            this.Name = "TabbedColorPicker";
            this.Size = new System.Drawing.Size(184, 32);
        }

        private void OnPopupClosed(object sender, System.EventArgs e)
        {
        }

        private void OnPopupColorChanged(object sender, ColorChangedEventArgs e)
        {
            this.Color = e.Color;
        }
    }
}